package com.hyt.it.ogt.controller.ykcj.grade;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.hyt.it.ogt.controller.base.BaseController;
import com.hyt.it.ogt.ykcj.common.annotation.Log;
import com.hyt.it.ogt.ykcj.common.core.domain.AjaxResult;
import com.hyt.it.ogt.ykcj.common.core.page.TableDataInfo;
import com.hyt.it.ogt.ykcj.common.enums.BusinessType;
import com.hyt.it.ogt.ykcj.common.utils.poi.ExcelUtil;
import com.hyt.it.ogt.ykcj.domain.grade.ServantInterviewAnalysisData;
import com.hyt.it.ogt.ykcj.service.grade.IServantInterviewAnalysisDataService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiSort;

/**
 * 公务员考试面试分析Controller
 *
 * @author admin
 * @date 2021-10-13
 */
@Api(tags = "grade.6.公务员考试面试分析", value = "公务员考试面试分析请求接口")
@ApiSort(value = 206)
@RestController
@RequestMapping("/grade/servantInterviewAnalysisData")
public class ServantInterviewAnalysisDataController extends BaseController {

  @Autowired
  private IServantInterviewAnalysisDataService servantInterviewAnalysisDataService;

  /**
   * 查询公务员考试面试分析列表
   */
  @GetMapping("/list")
  public TableDataInfo list(ServantInterviewAnalysisData servantInterviewAnalysisData) {
    startPage();
    List<ServantInterviewAnalysisData> list = servantInterviewAnalysisDataService
        .selectServantInterviewAnalysisDataList(servantInterviewAnalysisData);
    return getDataTable(list);
  }

  /**
   * 导出公务员考试面试分析列表
   */
  @Log(title = "公务员考试面试分析", businessType = BusinessType.EXPORT)
  @GetMapping("/export")
  public AjaxResult export(ServantInterviewAnalysisData servantInterviewAnalysisData) {
    List<ServantInterviewAnalysisData> list = servantInterviewAnalysisDataService
        .selectServantInterviewAnalysisDataList(servantInterviewAnalysisData);
    ExcelUtil<ServantInterviewAnalysisData> util = new ExcelUtil<ServantInterviewAnalysisData>(
        ServantInterviewAnalysisData.class);
    return util.exportExcel(list, "公务员考试面试分析数据");
  }

  /**
   * 获取公务员考试面试分析详细信息
   */
  @GetMapping(value = "/{id}")
  public AjaxResult getInfo(@PathVariable("id") String id) {
    return AjaxResult
        .success(servantInterviewAnalysisDataService.selectServantInterviewAnalysisDataById(id));
  }

  /**
   * 新增公务员考试面试分析
   */
  @Log(title = "公务员考试面试分析", businessType = BusinessType.INSERT)
  @PostMapping
  public AjaxResult add(@RequestBody ServantInterviewAnalysisData servantInterviewAnalysisData) {
    return toAjax(servantInterviewAnalysisDataService
        .insertServantInterviewAnalysisData(servantInterviewAnalysisData));
  }


}
